<script setup lang="ts">
import {useRouter} from "vue-router";
import {onMounted} from "vue";

//相当于router===$router
const router = useRouter()
onMounted(() => {
  testEven(0);
})

const testEven = (num: number) => {
  switch (num) {
    case 0:
      router.push('/Home/Me')
      break;
    case 1:
      router.push({path: '/Home/About'})
      break;
    default:
      router.push({path: '/Home/Me'})
  }

};

</script>

<template>
  <div class="parent">
    <h1 @click="testEven(0)">我的</h1>
    <h1 @click="testEven(1)">关于我</h1>
  </div>
</template>

<style scoped lang="less">
.parent {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 2px;

  h1 {
    margin-right: 20px;
    cursor: pointer;

    &:last-child {
      margin-right: 0;
    }

    &:hover {
      color: #42b983;
    }
  }
}
</style>